//
//  RHEnergySaveItemCell.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2023/10/12.
//

#import "RHEnergySaveItemCell.h"

@implementation RHEnergySaveItemCell
-(instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame]){
        [self setupUI];
    }
    return self;
}

-(void)setupUI
{
    UIView *bgView = kView;
    bgView.layer.cornerRadius = 8;
    bgView.layer.masksToBounds = YES;
    bgView.backgroundColor = kCOLOR_HEX(@"#F3F7FF");
    [self.contentView addSubview:bgView];
    
    self.bgView = bgView;
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
    
    _imageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_imageView];
    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.equalTo(@(CGSizeMake(30, 30)));
        make.top.mas_offset(18);
        make.left.mas_offset(15);
    }];
    
    _contentLab = [[QMUILabel alloc]init];
    _contentLab.text = @"--";
    _contentLab.font = [UIFont boldSystemFontOfSize:17];
    _contentLab.textAlignment = NSTextAlignmentLeft;
    _contentLab.textColor = kCOLOR_HEX(@"3F4443");
    [self.contentView addSubview:_contentLab];
    
    _titleLab = [[QMUILabel alloc]init];
    _titleLab.text = @"--".rh_localized;
    _titleLab.font = [UIFont systemFontOfSize:13];
    _titleLab.textAlignment = NSTextAlignmentLeft;
    _titleLab.numberOfLines = 2;
    _titleLab.adjustsFontSizeToFitWidth = YES;
    _titleLab.minimumScaleFactor = 0.6;
    _titleLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.6];
    [self.contentView addSubview:_titleLab];
    
    kWeakSelf;
    [_contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(weakSelf.imageView.mas_bottom).offset(15);
        make.right.mas_offset(-15);
    }];
    
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.contentLab);
        make.top.equalTo(weakSelf.contentLab.mas_bottom).offset(5);
        make.right.mas_offset(-15);
    }];
}
@end
